package cn.wusifx.zabbix.request.builder.discovery;

import cn.wusifx.zabbix.request.BaseRequest;
import cn.wusifx.zabbix.request.builder.RequestBuilder;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * https://www.zabbix.com/documentation/4.0/manual/api/reference/discoveryrule/copy
 */
public class LowLevelDiscoveryRuleCopyRequestBuilder extends RequestBuilder<Map<String, List>> {
    private List<String> discoveryIds;
    private List<String> hostIds;
    public LowLevelDiscoveryRuleCopyRequestBuilder(String auth) {
        super("discoveryrule.copy", auth);
        baseRequest.setParams(new HashMap<>());
    }

    public LowLevelDiscoveryRuleCopyRequestBuilder(Long id, String auth) {
        super("discoveryrule.copy", id, auth);
        builder().setParams(new HashMap<>());
    }

    public LowLevelDiscoveryRuleCopyRequestBuilder setParam(String key, List<String> value){
        baseRequest.getParams().put(key,value);
        return this;
    }

    public LowLevelDiscoveryRuleCopyRequestBuilder setParams(Map<String,List> params){
        baseRequest.getParams().putAll(params);
        return this;
    }

    public List<String> getDiscoveryIds() {
        return discoveryIds;
    }

    public LowLevelDiscoveryRuleCopyRequestBuilder setDiscoveryIds(List<String> discoveryIds) {
        this.discoveryIds = discoveryIds;
        return this;
    }

    public List<String> getHostIds() {
        return hostIds;
    }

    public LowLevelDiscoveryRuleCopyRequestBuilder setHostIds(List<String> hostIds) {
        this.hostIds = hostIds;
        return this;
    }

    @Override
    public BaseRequest<Map<String, List>> builder() {
        baseRequest.getParams().put("hostids",hostIds);
        baseRequest.getParams().put("discoveryids",discoveryIds);
        return baseRequest;
    }
}
